package com.example.hhhh;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;

/**
 * @ProjectName: Hhhh
 * @Package: com.example.hhhh
 * @ClassName: CycleView
 * @Description: java类作用描述
 * @Author: songhua
 * @CreateDate: 2020/4/27 0027 17:31
 */
public class CycleView extends View {
    Paint mPaint = new Paint();

    public CycleView(Context context) {
        this(context, null);
    }

    public CycleView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
    }

    private void initView() {
        mPaint.setAntiAlias(true);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(20);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawCircle(100, 100, 90, mPaint);
        Rect re =new Rect(0, 1000, 500,900);
        canvas.drawRect(re, mPaint);
    }
}
